package com.service;
import com.dao.AsAccountDao;
import com.utils.JsonUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;

@Service
public class AsAccountService
{
    @Resource
    private AsAccountDao asAccountDao;

    //返回当前用户的余额json数据
    public String getMoneyJsonStr( Integer userId )
    {
        Double money = asAccountDao.getMoneyByUserId( userId );
        return "{\"money\":"+money+"}";
    }

    //返回当前用户的余额Double类型数据
    public Double getMoney( Integer userId )
    {
        return asAccountDao.getMoneyByUserId( userId );
    }

    //返回财务账户信息的json数据
    public String retunFinancialUserAccountJsonStr()
    {
        Map<String,Object> account = asAccountDao.getFinancialUserAccount();
        String jsonStr = JsonUtil.toJsonStr( account );

        return jsonStr;
    }


}
